package dataframe

import (
	"github.com/kniren/gota/dataframe"
	"log"
	"os"
)

func main() {
	f, _ := os.Open("E:\\JetBrains\\GoglandProjects\\go_machine_learn\\data\\iris.csv")
	defer f.Close()
	irisdf := dataframe.ReadCSV(f, dataframe.Names("sepal_length", "sepal_width", "petal_length", "petal_width", "species"))
	log.Println(irisdf)
	filter := dataframe.F{
		Colname:    "species",
		Comparator: "==",
		Comparando: "Iris-setosa",
	}
	df := irisdf.Filter(filter)
	if df.Err != nil {
		log.Fatal(df.Err)
	}
	log.Println(df.Nrow())
	ex1 := df.Select([]string{"petal_width", "species"})
	log.Println(ex1)
	ex1 = ex1.Subset([]int{3, 4, 5})
	log.Println(ex1)
}
